package com.deyinet.bdcms.core.common;

/**
 * Created by Administrator on 2017/3/27 0027.
 */
public class StringUtil {
    public StringUtil() {
    }

    public static String toFirstUpperCase(String s) {
        char[] chars = s.toCharArray();
        chars[0] = (char) (chars[0] - 32);
        return new String(chars);
    }

    public static String toFirstLowerCase(String s) {
        char[] chars = s.toCharArray();
        chars[0] = (char) (chars[0] + 32);
        return new String(chars);
    }

    public static String getSetterMethodName(String fieldName) {
        return "set" + toFirstUpperCase(fieldName);
    }

    public static String getGetterMethodName(String fieldName) {
        return "get" + toFirstUpperCase(fieldName);
    }

    public static String getGetterMethodNameBoolean(String fieldName) {
        return "is" + toFirstUpperCase(fieldName);
    }

    public static boolean isEmpty(String str) {
        return str == null ? true : str.equals("") ? true : false;
    }
}
